package com.galaxy.samson.stock.service;

import com.galaxy.samson.stock.dao.IStockDao;
import com.galaxy.samson.stock.domain.Stock;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: arunachalam
 * Date: 2/6/12
 * Time: 7:44 PM
 * To change this template use File | Settings | File Templates.
 */
@Transactional
public class StockService implements IStockService
{
    private IStockDao stockDao;

    public IStockDao getStockDao()
    {
        return stockDao;
    }

    public void setStockDao(IStockDao stockDao)
    {
        this.stockDao = stockDao;
    }

    @Override
    public void insert(Stock stock) {
        stockDao.insert(stock);
    }

    @Override
    public void removeAll()
    {
        stockDao.removeAll();
    }

    @Override
    public void remove(String productName)
    {
        stockDao.remove(productName);
    }

    @Override
    public List<Stock> findAll()
    {
        return stockDao.findAll();
    }

    @Override
    public List<Stock> searchByCategory(String category)
    {
        return stockDao.searchByCategory(category);
    }

    @Override
    public List<Stock> searchByName(String productName)
    {
        return stockDao.searchByName(productName);
    }
}
